﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Transactions;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using DotNetOpenAuth.AspNet;
using Microsoft.Web.WebPages.OAuth;
using WebMatrix.WebData;
using MobilTomegSzerver.Filters;
using MobilTomegSzerver.Models;
using MobilTomegSzerver.Helpers;

namespace MobilTomegSzerver.Controllers
{
    public partial class AccountController : Controller
    {
        public virtual ActionResult Login(string returnUrl)
        {
            return View();
        }

        [HttpPost]
        public virtual ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid && model.UserName == "admin7" && model.Password == "MobTomV2")
            {
                SessionHelper.LoginSession = true;
                return RedirectToAction("Index", "Home");
            }

            ModelState.AddModelError("", "The user name or password provided is incorrect.");
            return View(model);
        }

        public virtual ActionResult LogOff()
        {
            SessionHelper.LoginSession = false;
            return RedirectToAction("Index", "Home");
        }
    }
}
